import java.util.ArrayList;
import java.util.List;

// 课程类
class Course {
    private String name;
    private int duration; // 课程时长，单位：小时

    public Course(String name, int duration) {
        this.name = name;
        this.duration = duration;
    }

    public String getName() {
        return name;
    }

    public int getDuration() {
        return duration;
    }
}

// 排课表类
class Schedule {
    private List<Course> courses = new ArrayList<>();
    private int totalDuration = 8; // 总课时

    public void addCourse(Course course) {
        if (totalDuration - course.getDuration() >= 0) {
            courses.add(course);
            totalDuration -= course.getDuration();
        } else {
            System.out.println("课程安排已满，无法添加更多课程。");
        }
    }

    public void printSchedule() {
        System.out.println("课程安排：");
        for (Course course : courses) {
            System.out.println(course.getName() + " - " + course.getDuration() + "小时");
        }
    }
}

